package com.atguigu.guli.service.ucenter.controller.admin;

import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.ucenter.entity.Member;
import com.atguigu.guli.service.ucenter.service.MemberService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/ucenter/member")
public class AdminMemberController {
    @Autowired
    MemberService memberService;
    //查询指定日期的注册用户数量
    @GetMapping("genRegistNum/{day}")
    public R genRegistNum(@PathVariable String day){
        QueryWrapper<Member> querywrapper = new QueryWrapper<>();

        querywrapper.eq("DATE(gmt_create)",day);
        int count = memberService.count(querywrapper);
        return R.ok().data("num",count+"");//jackson在处理json转为map时如果类型为基本数据类型的int，会被转为double类型

    }
}
